* Appendix tables and figures for "In Aid We Trust"

* Table A1. Sample Comparison: 80% Standard and 20% Extended Census

	* T-tests

		use "$directory/data/analysis.dta", clear

		reftab touse_trust hh_familysize hh_faultdist hh_intensity hh_epidist hh_fault_minimum c_home_des hh_assets_pca_post hh_district_? hh_slope ///
			 vil_aid_org_1 vil_aid_org_10 vil_aid_org_22 vil_aid_org_14 ///
			using "$directory/tables/Appendix_Tables_raw.xls" ///
			if tag_hh , by(census_type_code) refcat(1) ///
				replace n title("Table A. Short/Long Census Comparison") sheet("Table A1a1") ///
				lines(COL_NAMES 3 LAST_ROW 3)  format((SCLB0) (SCCB0 NCRR2) (SCCB0 NCRR2) (SCCB0 NCRR0) ) dec(2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2)
				
				
		reftab indiv_male indiv_age indiv_edu_primary indiv_edu_primary_f indiv_edu_primary_m  ///
			using "$directory/tables/Appendix_Tables_raw.xls" ///
			if indiv_dead == 0 & indiv_age > 17  , by(census_type_code) refcat(1) ///
				append n title("Table A. Short/Long Census Comparison") sheet("Table A1a2") ///
				lines(COL_NAMES 3 LAST_ROW 3)  format((SCLB0) (SCCB0 NCRR2) (SCCB0 NCRR2) (SCCB0 NCRR0) ) dec(2 2 2 2 2 2 2 2 2 2 2 2 2 2 2)
				
		local trust indiv_trust_note_a indiv_trust_note_g indiv_trust_note_h indiv_trust_note_f indiv_trust_note_i ///
				indiv_trust_note_c indiv_trust_note_b indiv_trust_note_d indiv_trust_note_e 
				
		local kindness indiv_trust_kind_a indiv_trust_kind_g indiv_trust_kind_h indiv_trust_kind_f indiv_trust_kind_i ///
			indiv_trust_kind_c indiv_trust_kind_b indiv_trust_kind_d indiv_trust_kind_e indiv_trust_q5_bin
			
		local risk indiv_trust_risk_1 indiv_trust_risk_2 indiv_trust_risk_3 indiv_trust_risk_4 indiv_trust_risk_5 indiv_trust_risk_6 indiv_trust_risk_7
		
		reftab `trust' `kindness' `risk'  ///
			using "$directory/tables/Appendix_Tables_raw.xls" ///
			if indiv_dead == 0  & indiv_trust_note_c != ., by(census_type_code) refcat(1)  ///
				append n title("Table A1. Short/Long Census Comparison") sheet("Table A1a3") ///
				lines(COL_NAMES 3 LAST_ROW 3)  format((SCLB0) (SCCB0 NCRR2) (SCCB0 NCRR2) (SCCB0 NCRR0) ) dec(2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2)
			
	* Normed differences
	
		use "$directory/data/analysis.dta", clear

		normdiff touse_trust hh_familysize hh_faultdist hh_intensity hh_epidist hh_fault_minimum c_home_des hh_assets_pca_post hh_district_? hh_slope ///
			 vil_aid_org_1 vil_aid_org_10 vil_aid_org_22 vil_aid_org_14 ///
			using "$directory/tables/Appendix_Tables_raw.xls" ///
			if tag_hh , by(census_type_code) refcat(1) ///
				append title("Table A. Short/Long Census Comparison") sheet("Table A1b1") ///
				lines(COL_NAMES 3 LAST_ROW 3)  format((SCLB0) (SCCB0 NCRR2) (SCCB0 NCRR2) (SCCB0 NCRR0) ) 
				
				
		normdiff indiv_male indiv_age indiv_edu_primary indiv_edu_primary_f indiv_edu_primary_m  ///
			using "$directory/tables/Appendix_Tables_raw.xls" ///
			if indiv_dead == 0 & indiv_age > 17  , by(census_type_code) refcat(1) ///
				append title("Table A. Short/Long Census Comparison") sheet("Table A1b2") ///
				lines(COL_NAMES 3 LAST_ROW 3)  format((SCLB0) (SCCB0 NCRR2) (SCCB0 NCRR2) (SCCB0 NCRR0) ) 
				
		local trust indiv_trust_note_a indiv_trust_note_g indiv_trust_note_h indiv_trust_note_f indiv_trust_note_i ///
				indiv_trust_note_c indiv_trust_note_b indiv_trust_note_d indiv_trust_note_e 
				
		local kindness indiv_trust_kind_a indiv_trust_kind_g indiv_trust_kind_h indiv_trust_kind_f indiv_trust_kind_i ///
			indiv_trust_kind_c indiv_trust_kind_b indiv_trust_kind_d indiv_trust_kind_e indiv_trust_q5_bin
			
		local risk indiv_trust_risk_1 indiv_trust_risk_2 indiv_trust_risk_3 indiv_trust_risk_4 indiv_trust_risk_5 indiv_trust_risk_6 indiv_trust_risk_7
		
		normdiff `trust' `kindness' `risk'  ///
			using "$directory/tables/Appendix_Tables_raw.xls" ///
			if indiv_dead == 0  & indiv_trust_note_c != ., by(census_type_code) refcat(1) ///
				append title("Table A1. Sample Comparison - 80% Standard and 20% Extended Census") sheet("Table A1b3") ///
				lines(COL_NAMES 3 LAST_ROW 3)  format((SCLB0) (SCCB0 NCRR2) (SCCB0 NCRR2) (SCCB0 NCRR0) ) 

				
* Table A2. Correlations Between Key Measures of Trust

	use "$directory/data/analysis.dta", clear
	keep if touse_trust == 1
	
	corr indiv_trust_note_h indiv_trust_kind_h indiv_trust_q5_bin 
	
	mat a = r(C)
	mat rownames a = "Trust Westerners" "Kindness Westerners" "Ability to Work Together"
	mat colnames a = "Trust Westerners" "Kindness Westerners" "Ability to Work Together"
	
	xml_tab a using "$directory/tables/Appendix_Tables_raw.xls", append ///
		lines(COL_NAMES 3 LAST_ROW 3) format((SCLB0) (SCCB2)) ///
		cnames("Trust Westerners" "Kindness Westerners" "Ability to Work Together") showeq ceq($numbering) ///
		title("Table A2. Correlations Between Key Measures of Trust") sheet("Table A2")
		
* Table A3. Trust in Outsiders after the Earthquake - Mean Village Distance Robustness

	use "$directory/data/analysis.dta", clear
	keep if touse_trust == 1

	local theVarlist ///
		indiv_trust_note_g indiv_trust_note_h  ///
		indiv_trust_note_c indiv_trust_note_b indiv_trust_note_d indiv_trust_note_e ///
		indiv_trust_q5_bin indiv_trust_note_dif
	
	local theCols ""
	qui foreach var of varlist `theVarlist' {
	
		xi: areg `var' vil_uc_dfl_mean indiv_edu_primary hh_wealth_2 hh_wealth_1 indiv_male hh_epidist hh_slope i.hh_district  ///
			, cl(village_code) a(indiv_age)
			est sto `var'
			
			local theLabel : var label `var'
			local theCols `"`theCols' "`theLabel'""'
			
			qui sum `var'
			local mean = `r(mean)'
			estadd scalar mean = `mean'
			
			}
			
	xilab i.hh_district 
			
	xml_tab `theVarlist' using "$directory/tables/Appendix_Tables_raw.xls", append below ///
		lines(COL_NAMES 3 LAST_ROW 3) format((SCLB0) (SCCB0 NCRR3)) ///
		cnames(`theCols') showeq ceq($numbering) ///
		c("Constant") stats(N r2 mean) title("Table A3. Trust in Outsiders after the Earthquake - Mean Village Distance Robustness ") sheet("Table A3") drop(o.* _Ihh_distri_*)

		
* Table A4. Mercalli Intensity and Pre-Earthquake Characteristic Exogeneity

	use "$directory/data/analysis.dta", clear
	
	* Fault RHS regressions for table
			
	local theVarlist_v /// Village
		vil_t39v3 vil_t39v4 vil_t39v5 vil_t39v11 vil_t39v6 vil_edu_primary vil_fem_secondary vil_t39v23 vil_t39v18 vil_t39v22 vil_t39v21 vil_infra 
		
	local theCols ""
	qui foreach var of varlist `theVarlist_v' {
	
		xi: reg `var' vil_intensity vil_uc_dist_epi vil_uc_slope_mean i.hh_district if tag_village == 1 ///
			, cl(village_code)
			est sto `var'
			
			local theLabel : var label `var'
			local theCols `"`theCols' "`theLabel'" "`theLabel'""'
			
			qui sum `var'
			local mean = `r(mean)'
			estadd scalar mean = `mean'
			
			}
		
	local theVarlist_i /// Individual	
		indiv_male_height indiv_female_height indiv_edu_primary_m indiv_edu_primary_f
		
	qui foreach var of varlist `theVarlist_i' {
	
		xi: reg `var' hh_intensity hh_epidist hh_slope i.hh_district if indiv_dead == 0 & indiv_age > 21 ///
			, cl(village_code)
			est sto `var'
			
			local theLabel : var label `var'
			local theCols `"`theCols' "`theLabel'" "`theLabel'""'
			
			qui sum `var' if indiv_dead == 0 & indiv_age > 21
			local mean = `r(mean)'
			estadd scalar mean = `mean'
			
			}
			
	local theVarlist_h /// Household	
		hh_stats_electricity_pre hh_water_inhouse_pre hh_perm_house_pre /// hh stats
		hh_stats_market_pre hh_stats_water_dist_pre hh_stats_medical_pre hh_stats_privateschool_pre hh_stats_govtschool_pre  ///
		hh_distance_pre_1 hh_distance_pre_2 hh_distance_pre_6 hh_distance_pre_4 hh_distance_pre_5
		
	qui foreach var of varlist `theVarlist_h' {
	
		xi: reg `var' hh_intensity hh_epidist hh_slope i.hh_district if tag_hh == 1 & touse_shock == 1 ///
			, cl(village_code)
			est sto `var'
			
			local theLabel : var label `var'
			local theCols `"`theCols' "`theLabel'" "`theLabel'""'
			
			qui sum `var'
			local mean = `r(mean)'
			estadd scalar mean = `mean'
			
			}
			
	xml_tab `theVarlist_v' ///
		`theVarlist_i' ///
		`theVarlist_h' ///
		using "$directory/tables/Appendix_Tables_raw.xls", append ///
		lines(COL_NAMES 3) format((SCLB0) (SCCB0 NCRR3)) cnames(`theCols') showeq ceq($numbering) ///
		keep(vil_intensity vil_uc_dist_epi vil_uc_slope_mean hh_intensity hh_epidist hh_slope _cons) ///
		c("Constant") stats(N r2 mean) title("Table A4. Mercalli Intensity and Pre-Earthquake Characteristic Exogeneity") sheet("Table A4")

		
* Table A5. Trust in Outsiders after the Earthquake: Mercalli Intensity Robustness

	use "$directory/data/analysis.dta", clear
	keep if touse_trust == 1

	local theVarlist ///
		indiv_trust_note_g indiv_trust_note_h  ///
		indiv_trust_note_c indiv_trust_note_b indiv_trust_note_d indiv_trust_note_e ///
		indiv_trust_q5_bin indiv_trust_note_dif
	
	local theCols ""
	qui foreach var of varlist `theVarlist' {
	
		xi: areg `var' hh_intensity indiv_edu_primary hh_wealth_2 hh_wealth_1 indiv_male hh_epidist hh_slope i.hh_district  ///
			, cl(village_code) a(indiv_age)
			est sto `var'
			
			local theLabel : var label `var'
			local theCols `"`theCols' "`theLabel'""'
			
			qui sum `var'
			local mean = `r(mean)'
			estadd scalar mean = `mean'
			
			}
			
	xilab i.hh_district 
			
	xml_tab `theVarlist' using "$directory/tables/Appendix_Tables_raw.xls", append below ///
		lines(COL_NAMES 3 LAST_ROW 3) format((SCLB0) (SCCB0 NCRR3)) ///
		cnames(`theCols') showeq ceq($numbering) ///
		c("Constant") stats(N r2 mean) title("Table A5. Trust in Outsiders after the Earthquake - Mercalli Intensity Robustness") sheet("Table A5") drop(o.* _Ihh_distri_*)


* Table A6. Distance to Faultline, Mortality and Destruction

	use "$directory/data/analysis.dta", clear
		
	xi: reg indiv_dead_quake hh_faultdist hh_epidist hh_slope hh_fault_minimum i.hh_district if indiv_age > 3, cl(village_code)
			est sto indiv_dead_quake
						
			qui sum indiv_dead_quake
			local mean = `r(mean)'
			estadd scalar mean = `mean'
	
	xi: reg vil_facil_destroyed vil_uc_dfl_mean vil_uc_dist_epi vil_uc_slope_mean i.hh_district if tag_village == 1
			est sto vil_facil_destroyed
						
			qui sum vil_facil_destroyed
			local mean = `r(mean)'
			estadd scalar mean = `mean'
	
	
	
	local theCols ""
	qui foreach var of varlist c_home_dam c_home_des {
	
		xi: reg `var' hh_faultdist hh_epidist hh_slope hh_fault_minimum i.hh_district if tag_hh == 1, cl(village_code)
			est sto `var'
			
			qui sum `var'
			local mean = `r(mean)'
			estadd scalar mean = `mean'
			
			}
	
		xilab i.hh_district
	gen mean = 0 
		label var mean "Mean"
			
	xml_tab c_home_dam c_home_des indiv_dead_quake vil_facil_destroyed  ///
		using "$directory/tables/Appendix_Tables_raw.xls", append below ///
		lines(COL_NAMES 3 LAST_ROW 3) format((SCLB0) (SCCB0 NCRR3)) cnames("Home Damaged or Destroyed" "Home Destroyed" "Died in Earthquake" "Village Facilities Destroyed") showeq ceq($numbering) ///
		c("Constant") stats(N r2 mean) title("Table A6. Distance to Faultline, Mortality and Destruction") sheet("Table A6") ///
		keep(vil_uc_dfl_mean vil_uc_dist_epi vil_uc_slope_mean hh_faultdist hh_epidist hh_slope _cons)
		
* Table A7. Distance to Faultline and Aid Reported by Households

	use "$directory/data/analysis.dta", clear
	
	local theCols ""
	 foreach var of varlist c_aid_org_1 c_aid_org_10 c_aid_org_22 c_aid_org_14 {
	
		xi: reg `var' hh_faultdist hh_epidist hh_slope hh_fault_minimum i.hh_district if tag_hh == 1 , cl(village_code)
			est sto `var'
			
			local theLabel : var label `var'
			local theCols `"`theCols' "`theLabel'""'
			
			qui sum `var'
			local mean = `r(mean)'
			estadd scalar mean = `mean'
			
			}
			
		xilab i.hh_district
	gen mean = 0 
		label var mean "Mean"
			
	xml_tab c_aid_org_1 c_aid_org_10 c_aid_org_22 c_aid_org_14 ///
		using "$directory/tables/Appendix_Tables_raw.xls", append below ///
		lines(COL_NAMES 3 LAST_ROW 3) format((SCLB0) (SCCB0 NCRR3)) cnames(`theCols') showeq ceq($numbering) ///
		c("Constant") stats(N r2 mean) title("Table A7. Distance to Faultline and Aid Reported by Households") sheet("Table A7") drop(_Ihh_distri_*)


* Table A8. Trust in Outsiders after the Earthquake - Local Groups

	use "$directory/data/analysis.dta", clear
	keep if touse_trust == 1
	
	local theVarlist ///
		indiv_trust_note_c indiv_trust_note_b indiv_trust_note_d indiv_trust_note_e 
	
	local theCols ""
	qui foreach var of varlist `theVarlist' {
	
		xi: areg `var' hh_faultdist indiv_edu_primary hh_wealth_2 hh_wealth_1 indiv_male hh_epidist hh_slope i.hh_district  ///
			, cl(village_code) a(indiv_age)
			est sto `var'
			
			local theLabel : var label `var'
			local theCols `"`theCols' "`theLabel'""'
			
			qui sum `var'
			local mean = `r(mean)'
			estadd scalar mean = `mean'
			
			}
			
	xilab i.hh_district 
			
	xml_tab `theVarlist' using "$directory/tables/Appendix_Tables_raw.xls", append below ///
		lines(COL_NAMES 3 LAST_ROW 3) format((SCLB0) (SCCB0 NCRR3)) ///
		cnames(`theCols') showeq ceq($numbering) ///
		c("Constant") stats(chowF N r2 mean) title("Table A8. Trust in Outsiders after the Earthquake � Local Groups") sheet("Table A8") drop(o.* _Ihh_distri_*)

	
* Table A9. Kindness of Outsiders after the Earthquake

	use "$directory/data/analysis.dta", clear
	keep if touse_trust == 1

	local theVarlist ///
		indiv_trust_kind_g indiv_trust_kind_h indiv_trust_kind_e ///
		indiv_trust_kind_dif
	
	local theCols ""
	qui foreach var of varlist `theVarlist' {
	
		xi: areg `var' hh_faultdist indiv_edu_primary hh_wealth_2 hh_wealth_1 indiv_male hh_epidist hh_slope hh_fault_minimum i.hh_district  ///
			, cl(village_code) a(indiv_age)
			est sto `var'
			
			local theLabel : var label `var'
			local theCols `"`theCols' "`theLabel'""'
			
			qui sum `var'
			local mean = `r(mean)'
			estadd scalar mean = `mean'
			
			}
			
	xilab i.hh_district 
			
	xml_tab `theVarlist' using "$directory/tables/Appendix_Tables_raw.xls", append below ///
		lines(COL_NAMES 3 LAST_ROW 3) format((SCLB0) (SCCB0 NCRR3)) ///
		cnames(`theCols') showeq ceq($numbering) ///
		c("Constant") stats(N r2 mean) title("Table A9. Kindness of Outsiders after the Earthquake") sheet("Table A9") drop(o.* _Ihh_distri_* hh_fault_minimum)

		
* Table A10. Trust in Outsiders after the Earthquake - Fault Exposure Robustness

	use "$directory/data/analysis.dta", clear
	keep if touse_trust == 1

	local theVarlist ///
		indiv_trust_note_g indiv_trust_note_h indiv_trust_note_e ///
		indiv_trust_q5_bin indiv_trust_note_dif
	
	local theCols ""
	qui foreach var of varlist `theVarlist' {
	
		xi: areg `var' hh_faultdist indiv_edu_primary hh_wealth_2 hh_wealth_1 indiv_male hh_epidist hh_slope i.hh_district  ///
			hh_fault_buf1k hh_fault_buf5k hh_fault_buf10k hh_fault_buf20k hh_fault_minimum ///
			, cl(village_code) a(indiv_age)
			
			est sto `var'
			
			local theLabel : var label `var'
			local theCols `"`theCols' "`theLabel'""'
			
			qui sum `var'
			local mean = `r(mean)'
			estadd scalar mean = `mean'
			
			}
			
	xilab i.hh_district 
			
	xml_tab `theVarlist' using "$directory/tables/Appendix_Tables_raw.xls", append below ///
		lines(COL_NAMES 3 LAST_ROW 3) format((SCLB0) (SCCB0 NCRR3)) ///
		cnames(`theCols') showeq ceq($numbering) ///
		c("Constant") stats(N r2 mean) title("Table A10. Trust in Outsiders after the Earthquake - Fault Exposure Robustness") sheet("Table A10") drop(o.* _Ihh_distri_*)

		
* Table A11. Trust in Outsiders after the Earthquake - Education Heterogeneity

	use "$directory/data/analysis.dta", clear
	keep if touse_trust == 1

	local theVarlist ///
		indiv_trust_note_h indiv_trust_q5_bin indiv_trust_note_dif
	
	local theCols ""
	qui foreach var of varlist `theVarlist' {
	
		xi: areg `var' hh_faultdist hh_faultdist hh_wealth_2 hh_wealth_1 indiv_male hh_epidist hh_slope hh_fault_minimum i.hh_district  ///
			if indiv_edu_primary == 1, cl(village_code) a(indiv_age)
			
			est sto `var'1
			
			qui sum `var' if indiv_male == 1
			local mean = `r(mean)'
			estadd scalar mean = `mean'
	
		xi: areg `var' hh_faultdist hh_faultdist hh_wealth_2 hh_wealth_1 indiv_male hh_epidist hh_slope hh_fault_minimum i.hh_district  ///
			if indiv_edu_primary == 0, cl(village_code) a(indiv_age)
			
			est sto `var'2
			
			qui sum `var' if indiv_male == 0
			local mean = `r(mean)'
			estadd scalar mean = `mean'
	
		xi: areg `var' hh_faultdist i.indiv_edu_primary*hh_faultdist hh_wealth_2 hh_wealth_1 indiv_male hh_epidist hh_slope hh_fault_minimum i.hh_district  ///
			, cl(village_code) a(indiv_age)
			
			est sto `var'3
			
			qui sum `var'
			local mean = `r(mean)'
			estadd scalar mean = `mean'
			
			local theLabel : var label `var'
			local theCols `"`theCols' "Male" "Female" "`theLabel'""'
			
			}
			
	xilab i.indiv_edu_primary*hh_faultdist
			
	xml_tab indiv_trust_note_h1 indiv_trust_note_h2 indiv_trust_note_h3 ///
		indiv_trust_q5_bin1 indiv_trust_q5_bin2 indiv_trust_q5_bin3 ///
		indiv_trust_note_dif1 indiv_trust_note_dif2 indiv_trust_note_dif3  ///
		using "$directory/tables/Appendix_Tables_raw.xls", append below ///
		lines(COL_NAMES 3 LAST_ROW 3) format((SCLB0) (SCCB0 NCRR3)) ///
		cnames(`theCols') showeq ceq($numbering) ///
		c("Constant") stats(N r2 mean) title("Table A11. Trust in Outsiders after the Earthquake - Education Heterogeneity") sheet("Table A11") drop(o.* _Ihh_distri_* hh_fault_minimum)	
		

* Table A12. Trust in Outsiders after the Earthquake - Gender Heterogeneity
	
	use "$directory/data/analysis.dta", clear
	keep if touse_trust == 1

	local theVarlist ///
		indiv_trust_note_h indiv_trust_q5_bin indiv_trust_note_dif
	
	local theCols ""
	qui foreach var of varlist `theVarlist' {
	
		xi: areg `var' hh_faultdist hh_faultdist hh_wealth_2 hh_wealth_1 indiv_edu_primary hh_epidist hh_slope hh_fault_minimum i.hh_district  ///
			if indiv_male == 1, cl(village_code) a(indiv_age)
			
			est sto `var'1
			
			qui sum `var' if indiv_male == 1
			local mean = `r(mean)'
			estadd scalar mean = `mean'
	
		xi: areg `var' hh_faultdist hh_faultdist hh_wealth_2 hh_wealth_1 indiv_edu_primary hh_epidist hh_slope hh_fault_minimum i.hh_district  ///
			if indiv_male == 0, cl(village_code) a(indiv_age)
			
			est sto `var'2
			
			qui sum `var' if indiv_male == 0
			local mean = `r(mean)'
			estadd scalar mean = `mean'
	
		xi: areg `var' hh_faultdist i.indiv_male*hh_faultdist hh_wealth_2 hh_wealth_1 indiv_edu_primary hh_epidist hh_slope hh_fault_minimum i.hh_district  ///
			, cl(village_code) a(indiv_age)
			
			est sto `var'3
			
			qui sum `var'
			local mean = `r(mean)'
			estadd scalar mean = `mean'
			
			local theLabel : var label `var'
			local theCols `"`theCols' "Male" "Female" "`theLabel'""'
			
			}
			
	xilab i.indiv_male*hh_faultdist
			
	xml_tab indiv_trust_note_h1 indiv_trust_note_h2 indiv_trust_note_h3 ///
		indiv_trust_q5_bin1 indiv_trust_q5_bin2 indiv_trust_q5_bin3 ///
		indiv_trust_note_dif1 indiv_trust_note_dif2 indiv_trust_note_dif3  ///
		using "$directory/tables/Appendix_Tables_raw.xls", append below ///
		lines(COL_NAMES 3 LAST_ROW 3) format((SCLB0) (SCCB0 NCRR3)) ///
		cnames(`theCols') showeq ceq($numbering) ///
		c("Constant") stats(N r2 mean) title("Table A12. Trust in Outsiders after the Earthquake - Gender Heterogeneity") sheet("Table A12") drop(o.* _Ihh_distri_* hh_fault_minimum)
		
		
* Table A13. Trust in Outsiders after the Earthquake - Risk Robustness

	use "$directory/data/analysis.dta", clear
	keep if touse_trust == 1

	local theVarlist ///
		indiv_trust_note_g indiv_trust_note_h indiv_trust_note_e ///
		indiv_trust_q5_bin indiv_trust_note_dif
	
	local theCols ""
	qui foreach var of varlist `theVarlist' {
	
		xi: areg `var' hh_faultdist indiv_edu_primary hh_wealth_2 hh_wealth_1 indiv_male hh_epidist hh_slope hh_fault_minimum i.hh_district  ///
			i.indiv_trust_risk if indiv_trust_risk != 7 ///
			, cl(village_code) a(indiv_age)
			
			est sto `var'
			
			local theLabel : var label `var'
			local theCols `"`theCols' "`theLabel'""'
			
			qui sum `var'
			local mean = `r(mean)'
			estadd scalar mean = `mean'
			
			}
			
	xilab i.hh_district i.indiv_trust_risk
			
	xml_tab `theVarlist' using "$directory/tables/Appendix_Tables_raw.xls", append below ///
		lines(COL_NAMES 3 LAST_ROW 3) format((SCLB0) (SCCB0 NCRR3)) ///
		cnames(`theCols') showeq ceq($numbering) ///
		c("Constant") stats(N r2 mean) title("Table A13. Trust in Outsiders after the Earthquake - Risk Robustness") sheet("Table A13") drop(o.* _Ihh_distri_* hh_fault_minimum)

		
* Table A14. Adult Migration after the Earthquake

	use "$directory/data/analysis.dta", clear
	keep if indiv_age > 17 & touse_trust == 1

	local theVarlist ///
		indiv_moveout indiv_movein
	
	local theCols ""
	foreach var of varlist `theVarlist'  {
	
		xi: areg `var' hh_faultdist hh_wealth_2 hh_wealth_1 indiv_male hh_epidist hh_slope hh_fault_minimum i.hh_district  ///
			, cl(village_code) a(indiv_age)
			est sto `var'
			
			local theLabel : var label `var'
			local theCols `"`theCols' "`theLabel'""'
			
			qui sum `var'
			local mean = `r(mean)'
			estadd scalar mean = `mean'
			
			}
			
	xilab i.hh_district 
			
	xml_tab `theVarlist' using "$directory/tables/Appendix_Tables_raw.xls", append below ///
		lines(COL_NAMES 3 LAST_ROW 3) format((SCLB0) (SCCB0 NCRR3)) ///
		cnames("Out Migration" "In Migration") showeq ceq($numbering) ///
		c("Constant") stats(N r2 mean) title("Table A14. Adult Migration after the Earthquake") sheet("Table A14") drop(o.* _Ihh_distri_* hh_fault_minimum)
	
	
*  Have a lovely day!
